package demo1224.homework;


//2.使用FileWriter对象向D:\a.txt文件中写入一首诗.

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) {

        try {
            FileWriter fw = new FileWriter(new File("D:\\a.txt"));
            fw.write("床前明月光");
            fw.write("\r\n");
            fw.write("疑是地上霜");
            fw.write("\r\n");
            fw.write("举头望明月");
            fw.write("\r\n");
            fw.write("低头思故乡");
            fw.flush();
            fw.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
